package com.lingyun.mqttserver.controller;

import com.lingyun.mqttserver.service.ManageDataService;
import com.lingyun.mqttserver.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("data-monitor")
public class DataMonitorController {

    @Autowired
    private ManageDataService manageDataService;

    /**
     * 获取实时数据列表
     */
//    @GetMapping("realtimeData")
//    public Result realtimeData(Integer projectId, Integer deviceId, Integer limit){
//        return manageDataService.realtimeData(projectId, deviceId, limit);
//    }


    /**
     * 查询历史数据
     */
//    @GetMapping("historyData")
//    public Result historyData(@RequestParam Integer variableId,
//                              @RequestParam String startTime,
//                              @RequestParam String endTime,
//                              @RequestParam(required = false) Integer interval,
//                              @RequestParam(required = false) Integer limit) {
//        return manageDataService.historyData(variableId, startTime, endTime, interval, limit);
//    }

    /**
     * 数据统计信息
     */
    @GetMapping("dataStats")
    public Result dataStats(@RequestParam Integer variableId,
                              @RequestParam String startTime,
                              @RequestParam String endTime) {
        return manageDataService.dataStats(variableId, startTime, endTime);
    }



}
